import React,{
    lazy,
    Suspense
} from "react";
import {useRoutes} from "react-router-dom";
const Index = lazy(()=>import("@/pages/Index"));
const Login = lazy(()=>import("@/pages/Login"));
const NotFound = lazy(()=>import("@/pages/NotFound"));

export default function (){
    return useRoutes([
        {
            path:"/",
            element:(
                <Suspense fallback={<h3>加载中……</h3>}>
                    <Index/>
                </Suspense>
            )
        },{
            path:"/login",
            element:(
                <Suspense fallback={<h3>加载中……</h3>}>
                    <Login/>
                </Suspense>
            )
        },{
            path:"*",
            element:(
                <Suspense fallback={<h3>加载中……</h3>}>
                    <NotFound/>
                </Suspense>
            )
        }
    ])
}
